package com.hotelvip.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.hotelvip.common.utils.EnumUtil;
import com.hotelvip.entity.VItem;
import com.hotelvip.entity.VipCard;
import com.hotelvip.enumEntity.CardStatueEnum;
import com.hotelvip.enumEntity.FlagEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * 会员套餐vo对象
 * @author Lzh
 * @date 2020/12/22 15:15
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "会员套餐vo对象",description = "会员套餐vo对象VipCardVo")
@Accessors(chain = true)
public class VipCardVo {
    @ApiModelProperty(value = "VipCard对象",name = "vipCard")
    private VipCard vipCard;
    @ApiModelProperty(value = "VipCard对象",name = "vipCard")
    private List<VItem> vItems;
    @ApiModelProperty(value = " 状态CardStatueEnum",name = "status")
    private String statusText;
    @ApiModelProperty(value = "是否返现",name = "rmFlag")
    private String rmFlagText;
    @ApiModelProperty(value = "是否转让",name = "rcFlag")
    private String rcFlagText;

    public String getStatusText(){
        if (vipCard.getStatus()==null || EnumUtil.getByindex(vipCard.getStatus(), CardStatueEnum.class)==null){
            return "";
        }
        return EnumUtil.getByindex(vipCard.getStatus(), FlagEnum.class).getName();
    }

    public String getRmFlagText(){
        if (vipCard.getRmFlag()==null || EnumUtil.getByindex(vipCard.getRmFlag(), FlagEnum.class)==null){
            return "";
        }
        return EnumUtil.getByindex(vipCard.getRmFlag(), FlagEnum.class).getName();
    }

    public String getRcFlagText(){
        if (vipCard.getRcFlag()==null || EnumUtil.getByindex(vipCard.getRcFlag(), FlagEnum.class)==null){
            return "";
        }
        return EnumUtil.getByindex(vipCard.getRcFlag(), FlagEnum.class).getName();
    }

}
